function openCity(evt, cityName) {
    var i, tabcontent, tablinks;

    tabcontent = document.querySelectorAll(".tabcontent");
    for (i = 0; i < tabcontent.length; i++) {
        tabcontent[i].style.display = "none";
    }

    tablinks = document.querySelectorAll(".tablinks");
    for (i = 0; i < tablinks.length; i++) {
        tablinks[i].className = tablinks[i].className.replace("active", "");
    }

    document.getElementById(cityName).style.display = "block";
    evt.currentTarget.className += "active";

    document.querySelectorAll(".tablinks")[0].click();
}
//给h3字体添加随机颜色并且每0.5秒刷新一次
function changeColor() {
    var colors = ["red", "blue", "green", "yellow", "orange", "purple", "pink", "brown", "gray", "black"];
    var randomColor = colors[Math.floor(Math.random() * colors.length)];
    document.querySelector("h3").style.color = randomColor;
}
setInterval(changeColor, 500);